package com.redoor.app.stake.basicdata.controller;

import com.redoornetwork.framework.core.response.ResponseResult;
import com.redoornetwork.framework.core.response.ResultGenerator;
import com.yotouch.app.stake.hsf.AssetsCenterService;
import com.yotouch.app.stake.hsf.kd.KdCountStakeService;
import com.yotouch.app.stake.hsf.qz.QzEquipmentService;
import com.yotouch.app.stake.hsf.qz.QzVendorService;
import com.yotouch.app.stake.model.CountStake;
import com.yotouch.app.stake.model.Equipment;
import com.yotouch.app.stake.model.Vendor;
import com.yotouch.app.stake.model.response.ResponseAssetsCenter;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * HFS 接口测试
 * Created by zhangYiHang on 2018/3/30.
 */
@RestController
@RequestMapping("/test/TestHSF")
public class TestHSFController {

    //厂商列表接口
    @Autowired
    private QzVendorService qzVendorService;

    //设备型号接口
    @Autowired
    private QzEquipmentService qzEquipmentService;
    //大屏统计接口
    @Autowired
    private AssetsCenterService assetsCenterService;
    //I6000统计指标接口
    @Autowired
    private KdCountStakeService kdCountStakeService;

    @ApiOperation(value = "查询全部厂家,厂商列表接口")
    @PostMapping("/vendorList")
    public ResponseResult qryVendorList(){
        List<Vendor> vendors = this.qzVendorService.queryVendor();
        return ResultGenerator.generatorSuccess(vendors);

    }
    @ApiOperation(value = "根据厂家主键查询设备型号列表,设备型号接口")
    @ApiParam(name = "vendorUuid", value = "厂家UUID")
    @PostMapping("/qryEquipmentByVendorUuid")
    public ResponseResult queryEquipmentByVendorUuid(String vendorUuid){
        List<Equipment> list = this.qzEquipmentService.queryEquipmentByVendorUuid(vendorUuid);
        return ResultGenerator.generatorSuccess(list);
    }
    @ApiOperation(value = "查询充电站地理信息包括充电站实时状态、设备状态等信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgType", value = "层级类型：1国；2省；3市；6：高速（G0：所有高速站点，G[x]单条高速站点）", paramType = "query", dataType = "int", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "orgNo", value = "区域编码", paramType = "query", dataType = "String", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "stationType", value = " 0：查询所有的，1：国网;2:社会（不含个人共享桩）；3：个人共享", paramType = "query", dataType = "int", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "pageNum", value = " 请求当前页数", paramType = "query", dataType = "int", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "pageSize", value = " 目前按100条记录进行分页", paramType = "query", dataType = "int", required = true, defaultValue = "1")
    })
    @PostMapping("/getStationGISInfo")
    public ResponseAssetsCenter getStationGISInfo(int orgType, String orgNo, int stationType, int pageNum, int pageSize) {
        return this.assetsCenterService.getStationGISInfo(orgType, orgNo, stationType, pageNum, pageSize);
    }

    @ApiOperation(value = "根据区域编码和层级关系获取充电桩总况信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgNo", value = " 区域编码", paramType = "query", dataType = "String", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "orgType", value = "层级类型:1国;2省;3市;4站;5桩6、高速", paramType = "query", dataType = "int", required = true, defaultValue = "1")
    })
    @PostMapping("/getGlobalMonitor")
    public ResponseAssetsCenter getGlobalMonitor(String orgNo, int orgType){
        return this.assetsCenterService.getGlobalMonitor(orgNo,orgType);
    }

    @ApiOperation(value = "根据区域编码和层级关系获取充电桩区域分布")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgNo", value = " 区域编码", paramType = "query", dataType = "String", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "orgType", value = "层级类型:1国;2省;3市;4站;5桩6、高速", paramType = "query", dataType = "int", required = true, defaultValue = "1")
    })
    @PostMapping("/getRegionStatistic")
    public ResponseAssetsCenter getRegionStatistic(String orgNo, int orgType){
        return this.assetsCenterService.getRegionStatistic(orgNo,orgType);
    }
    @ApiOperation(value = "根据充电站标识获取充电站运行信息")
    @ApiImplicitParam(name = "stationNo", value = "站编码", paramType = "query", dataType = "String", required = true, defaultValue = "1")
    @PostMapping("/getChargingWorkingInfo")
    public ResponseAssetsCenter getChargingWorkingInfo(String stationNo){
       return this.assetsCenterService.getChargingWorkingInfo(stationNo);
    }
    @ApiOperation(value = "根据桩编码获取充电站相关信息")
    @ApiImplicitParam(name = "stakeNo", value = "桩编码", paramType = "query", dataType = "String", required = true, defaultValue = "1")
    @PostMapping("/getPileMonitor")
    public ResponseAssetsCenter getPileMonitor(String stakeNo){
       return this.assetsCenterService.getPileMonitor(stakeNo);
    }
    @ApiOperation(value = "通过高速编号获取高速覆盖信息")
    @ApiImplicitParam(name = "gsNo", value = "高速编号,高速公路查询时全局传G0", paramType = "query", dataType = "String", required = true, defaultValue = "1")
    @PostMapping("/getHighWayRegion")
    public ResponseAssetsCenter getHighWayRegion(String gsNo){
        return this.assetsCenterService.getHighWayRegion(gsNo);
    }
    @ApiOperation(value = "社会充电桩排名返回排名前8的数据")
    @PostMapping("/getSocialPileRank")
    public ResponseAssetsCenter getSocialPileRank(){
        return this.assetsCenterService.getSocialPileRank();
    }
    @ApiOperation(value = "各省充电桩运营商分布情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgNO", value = " 区域编码", paramType = "query", dataType = "String", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "orgType", value = "层级类型:1国;2省;", paramType = "query", dataType = "int", required = true, defaultValue = "1")
    })
    @PostMapping("/getProvinceSocialPileRank")
    public ResponseAssetsCenter getProvinceSocialPileRank(String orgNO, int orgType){
       return this.assetsCenterService.getProvinceSocialPileRank(orgNO,orgType);
    }
    @ApiOperation(value = "查询全国或各省份的城市充电站的分别情况,按城市统计并返回")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgNo", value = " 区域编码", paramType = "query", dataType = "String", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "orgType", value = "层级类型:1国;2省;", paramType = "query", dataType = "int", required = true, defaultValue = "1"),
            @ApiImplicitParam(name = "queryType", value = " 0:全部；1：国网。", paramType = "query", dataType = "int", required = true, defaultValue = "1")
    })
    @PostMapping("/getCitysStationInfo")
    public ResponseAssetsCenter getCitysStationInfo(String orgNo, int orgType, int queryType){
        return this.assetsCenterService.getCitysStationInfo(orgNo,orgType,queryType);
    }
    @ApiOperation(value = " 统计充电桩数据:1、充电桩接入总数2、自营充电桩总数  3、社会充电桩总数4、在线运行桩数量")
    @PostMapping("/countStakeData")
    public CountStake countStakeData(){
        return this.kdCountStakeService.countStakeData();
    }
}
